#include "OgreAMLPlugin.h"

#include <OgreRoot.h>

namespace Ogre
{

//-------------------------------------------------------------------------------------------------------------------------------------------------
AMLPlugin* gAMLPlugin = NULL;
//-------------------------------------------------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------------------------------------------------
extern "C" void _OgrePluginAMLExport dllStartPlugin(void)
{
	assert( !gAMLPlugin && "Application bug, dllStartPlugin is called twice" );

	// Create new plugin
	gAMLPlugin = OGRE_NEW_T( AMLPlugin, MEMCATEGORY_GENERAL )();

	// Register plugin instance
	Root::getSingleton().installPlugin( gAMLPlugin );
}

//-------------------------------------------------------------------------------------------------------------------------------------------------
extern "C" void _OgrePluginAMLExport dllStopPlugin(void)
{
	assert( gAMLPlugin && "Application bug, dllStopPlugin: Plugin not initialised" );

	// Remove plugin instance
	Root::getSingleton().uninstallPlugin( gAMLPlugin );

	// Destroy plugin instance
	OGRE_DELETE_T( gAMLPlugin, AMLPlugin, MEMCATEGORY_GENERAL );
	gAMLPlugin = NULL;

}

} // end of namespace Ogre
